﻿using M.ShopMachine.Domain;
using M.ShopMachine.Read.WebApi.Application.Command.WorkshopCommand;
using M.ShopMachine.Repository.Interface;
using MediatR;

namespace M.ShopMachine.Read.WebApi.Application.Handler.WorkshopHandler
{
    public class GetFormWorkshopHandler : IRequestHandler<GetFormWorkshopCommand, Workshop>
    {
        private readonly IWorkshopRepository workshopRepository;

        public GetFormWorkshopHandler(IWorkshopRepository workshopRepository)
        {
            this.workshopRepository = workshopRepository;
        }

        public async Task<Workshop> Handle(GetFormWorkshopCommand request, CancellationToken cancellationToken)
        {
            return await workshopRepository.GetFormWorkshopAsync(request.id);
        }
    }
}
